package com.suray.basic.wcs.plc.utils;

public enum LifterTaskProcess {
    INIT(0, "初始化"),
    GO_TO_START(10, "前往起点"),
    GET_CARGO(30, "取货"),
    GET_CARGO_TO_LIFTER(40, "前往提升机内"),
    GO_TO_TARGET_FLOOR(45, "前往目标层"),
    GO_TO_END(50, "前往终点"),
    PUT_CARGO(70, "放货"),
    BACK_LIFTER(90, "回提升机内"),
    END(100, "提升机结束"),
    ALL_DEVICE_COMPLETE(-90, "所有设备完成");

    int value;
    String des;
    LifterTaskProcess(int value, String des) {
        this.value = value;
        this.des = des;
    }

    public int getValue() {
        return value;
    }

    public static LifterTaskProcess parseProcess(int value) {
        for (LifterTaskProcess process : LifterTaskProcess.values()) {
            if (process.value == value) {
                return process;
            }
        }

        throw new RuntimeException("转换提升机任务进度错误:" + value);
    }

    public static LifterTaskProcess parseProcess(String des) {
        for (LifterTaskProcess process : LifterTaskProcess.values()) {
            if (process.des.equals(des)) {
                return process;
            }
        }

        throw new RuntimeException("转换提升机任务进度错误:" + des);
    }

    @Override
    public String toString() {
        return des;
    }
}
